using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sec_scan漏洞扫描系统.Sec_Config
{
    /// <summary>
    /// base64编码 与 解码
    /// </summary>
    public class Sec_Base64Code
    {
        /// <summary>
        /// base64编码
        /// </summary>
        /// <param name="bs64"></param>
        /// <returns></returns>
        public static string Tobase64(string bs64)
        {
            if (bs64 == null || bs64 == "")
            {
                return "";
            }
            byte[] vs = Encoding.UTF8.GetBytes(bs64);
            return Convert.ToBase64String(vs);
        }
        /// <summary>
        /// base64解码
        /// </summary>
        /// <param name="bs64"></param>
        /// <returns></returns>
        public static string Gobase64(string bs64)
        {
            if (bs64 == null || bs64 == "")
            {
                return "";
            }
            byte[] bytes = Convert.FromBase64String(bs64);
            return Encoding.UTF8.GetString(bytes);
        }
    }
}
